# -*- coding: utf-8 -*-
"""
Created on Thu Sep 28 08:50:04 2017

@author: Luther
"""

from math import sqrt


def isprime(x):
    if x == 1:
        return False
    else:
        k = int(sqrt(x))
        for j in range(2, k + 1):
            if x % j == 0:
                return False
        return True


def monisen(no):
    i = 1
    x = 2
    while i <= int(no):
        if isprime(x):
            m = 2**x - 1
            if isprime(m):
                i = i + 1
        x = x + 1
    return m


print(monisen(int(input())))

#for j in range(1,6):
#    print(monisen(j), end=' ')
#    j = j+1
